package com.example.alipay.common;


/**
 * @Description: 返回结果枚举类
 * @Param:
 * @return:
 */
public enum ResponseStatus {

    /**
     * @Description: 成功
     * @Param:
     * @return:
     */
    SUCCESS(0, "Success"),

    /**
     * @Description: 其他错误
     * @Param:
     * @return:
     */
    OTHER_ERROR(1, "Other error"),

    /**
     * @Description: 参数错误
     * @Param:
     * @return:
     */
    PARAMETER_ERROR(400, "Parameter error"),

    /**
     * @Description: 系统错误
     * @Param:
     * @return:
     */
    SYSTEM_ERROR(500, "System error"),

    /**
     * @Description: 登录错误
     * @Param:
     * @return:
     */
    UNREGISTERED(1001, "Unregistered"),

    /**
     * @Description: 身份错误
     * @Param:
     * @return:
     */
    IDENTITY_ERROR(1002, "Identity_error"),

    /**
     * @Description: 前端自定义处理结果
     * @Param:
     * @return:
     */
    HANDER_ERROR(1003, "前端自定义处理结果");

    private final int value;

    private final String reasonPhrase;

    ResponseStatus(int value, String reasonPhrase) {
        this.value = value;
        this.reasonPhrase = reasonPhrase;
    }

    public int value() {
        return this.value;
    }

    public String getReasonPhrase() {
        return this.reasonPhrase;
    }

    @Override
    public String toString() {
        return Integer.toString(this.value);
    }

    public static ResponseStatus valueOf(int statusCode) {
        for (ResponseStatus status : values()) {
            if (status.value == statusCode) {
                return status;
            }
        }
        throw new RuntimeException("No matching constant for [" + statusCode + "]");
    }
}

